package com.study_online.controller;/*
    张昊（java文件）
 
*/

import com.study_online.domain.ResultInfo;
import com.study_online.service.VideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/Video")
public class VideoConntroller {

    @Autowired
    private VideoService videoService;

    //根据视频id查询视频的地址
    @RequestMapping("/findVideoId")
    public ResultInfo findVideoId(Integer videoId){
        ResultInfo videoIp = videoService.findVideoId(videoId);
        return videoIp;
    }

    //查询所有视频
    @RequestMapping("/findAll")
    public ResultInfo findAll(){
        ResultInfo video = videoService.findAll();
        return video;
    }

    //查询视频简介
    @RequestMapping("/findIntroud")
    public ResultInfo findIntroud(Integer videoId){
         ResultInfo introud=videoService.findIntroud(videoId);
         return introud;
    }

    //查询该视频是否被标记
    @RequestMapping("/findIsNote")
    public ResultInfo findIsNote(Integer videoId){
        ResultInfo isNote=videoService.findIsNote(videoId);
        return isNote;
    }
    //进行标记，存入标记表
    @RequestMapping("/saveNote")
    public ResultInfo saveNote(Integer videoId){
        ResultInfo saveNote=videoService.saveNote(videoId);
        return saveNote;
    }

    //删除该标记，从标记表中删除该标记
    @RequestMapping("/delNote")
    public ResultInfo delNote(Integer noteid){
        ResultInfo delNote=videoService.delNote(noteid);
        return delNote;
    }

    /*视频信息的添加*/
    @RequestMapping("/addVideos")
    public ResultInfo addVideos(String videoName,String videoIntroud,Integer videoTypeId,String videoIp,String pictureIp,String videoPay){
        ResultInfo status=videoService.insertData(videoName,videoIntroud,videoTypeId,videoIp,pictureIp,videoPay);
        return status;
    }


}
